#!/usr/bin/python
# coding:utf-8 
import requests

def http_get(url):
    headers = {'Content-Type': 'application/json'}
    resp = requests.get(url, headers=headers)
    return resp 

if __name__ == "__main__":
    base_url = 'http://localhost:8080/stats/flow/'
    for switch_id in [1, 2]:
        url = base_url + str(switch_id)
        resp = http_get(url)
        with open(f'switch_id_{switch_id}.json', 'w') as file:
            file.write(resp.text)
        print(f"Data saved to switch_id_{switch_id}.json")
